#pragma once

#include <QWidget>
#include "ui_TalkWindow.h"
#include "SendFile.h"

class TalkWindow : public QWidget
{
	Q_OBJECT

public:
	TalkWindow(const int id, QWidget *parent = Q_NULLPTR);
	~TalkWindow();

public:
	void setWindowName(const QString& name);

	void addEmotionImage(int emotionName);

	int getTalkID() const;

	void appendObjMsg(QJsonArray& array,const QString& obj);

private:
	void init();
	void initStyle();
	void initConnect();
	void initTalkType();
	void initTalkWindow();
	void initGroupTalk();
	void initSingleTalk();

	QJsonArray parseDocumentToJson(QTextDocument* document);

private:
	Ui::TalkWindow ui;

	const int m_talkID;
	bool isGroupType;

	SendFile* m_sendFile = nullptr;

private slots:
	void onSendBtnClicked();

	void onItemDoubleClicked(QTreeWidgetItem* item);

	void onFileopenBtnClicked();

};
